package org.example.lanchain.dto;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 登录响应DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginResponse {
    
    /**
     * 是否成功
     */
    private Boolean success;
    
    /**
     * 消息
     */
    private String message;
    
    /**
     * 访问令牌
     */
    private String token;
    
    /**
     * 用户信息
     */
    private UserInfo userInfo;
    
    /**
     * 过期时间
     */
    private LocalDateTime expireTime;
    
    /**
     * 用户信息内部类
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class UserInfo {
        private Long id;
        private String username;
        private String email;
        private String role;
        private String status;
        private LocalDateTime lastLoginTime;
    }
    
    /**
     * 成功响应
     */
    public static LoginResponse success(String token, UserInfo userInfo, LocalDateTime expireTime) {
        return new LoginResponse(true, "登录成功", token, userInfo, expireTime);
    }
    
    /**
     * 失败响应
     */
    public static LoginResponse failure(String message) {
        return new LoginResponse(false, message, null, null, null);
    }
} 